//
//  FeedDetail.swift
//
//  Created by zwb on 2018/5/18
//  Copyright (c) aowang. All rights reserved.
//

import Foundation
import ObjectMapper

public final class ZyaFeedDetail: Mappable {

  // MARK: Declaration for string constants to be used to decode and also serialize.
  private struct SerializationKeys {
    static let orgCode = "org_code"
    static let orgName = "org_name"
    static let idKey = "id_key"
    static let sClientAddress = "s_client_address"
    static let sOperationId = "s_operation_id"
    static let brandSortId = "brand_sort_id"
    static let amount = "amount"
    static let vouId = "vou_id"
    static let price = "price"
    static let basSortCode = "bas_sort_code"
  }

  // MARK: Properties
  public var orgCode: String?
  public var orgName: String?
  public var idKey: String?
  public var sClientAddress: String?
  public var sOperationId: String?
  public var brandSortId: String?
  public var amount: String?
  public var vouId: String?
  public var price: String?
  public var basSortCode: String?

  // MARK: ObjectMapper Initializers
  /// Map a JSON object to this class using ObjectMapper.
  ///
  /// - parameter map: A mapping from ObjectMapper.
  public required init?(map: Map){

  }

  /// Map a JSON object to this class using ObjectMapper.
  ///
  /// - parameter map: A mapping from ObjectMapper.
  public func mapping(map: Map) {
    orgCode <- map[SerializationKeys.orgCode]
    orgName <- map[SerializationKeys.orgName]
    idKey <- map[SerializationKeys.idKey]
    sClientAddress <- map[SerializationKeys.sClientAddress]
    sOperationId <- map[SerializationKeys.sOperationId]
    brandSortId <- map[SerializationKeys.brandSortId]
    amount <- map[SerializationKeys.amount]
    vouId <- map[SerializationKeys.vouId]
    price <- map[SerializationKeys.price]
    basSortCode <- map[SerializationKeys.basSortCode]
  }

  /// Generates description of the object in the form of a NSDictionary.
  ///
  /// - returns: A Key value pair containing all valid values in the object.
  public func dictionaryRepresentation() -> [String: Any] {
    var dictionary: [String: Any] = [:]
    if let value = orgCode { dictionary[SerializationKeys.orgCode] = value }
    if let value = orgName { dictionary[SerializationKeys.orgName] = value }
    if let value = idKey { dictionary[SerializationKeys.idKey] = value }
    if let value = sClientAddress { dictionary[SerializationKeys.sClientAddress] = value }
    if let value = sOperationId { dictionary[SerializationKeys.sOperationId] = value }
    if let value = brandSortId { dictionary[SerializationKeys.brandSortId] = value }
    if let value = amount { dictionary[SerializationKeys.amount] = value }
    if let value = vouId { dictionary[SerializationKeys.vouId] = value }
    if let value = price { dictionary[SerializationKeys.price] = value }
    if let value = basSortCode { dictionary[SerializationKeys.basSortCode] = value }
    return dictionary
  }

}
